#include "Scene.h"

Scene::Scene(void)
{
}

Scene::~Scene(void)
{
}

bool Scene::Init()
{
	m_boardType = TYPE_SCENE;
	m_attribute = ATTR_ALL;
	SetBoardPos(50,50);
	SetBoardSize(500,300);
	Board::Init();
	return true;
}

bool Scene::Frame()
{
	Board::Frame();
	std::list<Board*>::iterator iter_pos;
	for( iter_pos = m_ChildBoardList.begin(); iter_pos != m_ChildBoardList.end(); ++iter_pos)
	{
		(*iter_pos)->Frame();
	}
	return true;
}

bool Scene::Render()
{
	Board::Render();
	std::list<Board*>::iterator iter_pos;
	for( iter_pos = m_ChildBoardList.begin(); iter_pos != m_ChildBoardList.end(); ++iter_pos)
	{
		(*iter_pos)->Render();
	}
	return true;
}

bool Scene::Release()
{
	Board::Release();
	return true;
}

void Scene::InputProcess()
{
	Board::InputProcess();

	if( GetCapturedBoard() != this )
		return;

	if(IsMoveable())
	{
		std::list<Board*>::iterator iter_active;
		for( iter_active = m_ChildBoardList.begin(); iter_active != m_ChildBoardList.end(); ++iter_active)
		{
			(*iter_active)->SetActiveBoard(false);
			(*iter_active)->SetBoardPos(	(*iter_active)->GetBoardPosX() + m_pInput->GetCursorMoveX(), 
											(*iter_active)->GetBoardPosY() + m_pInput->GetCursorMoveY() );

		}
		SetBoardPos(m_posX + m_pInput->GetCursorMoveX() , m_posY + m_pInput->GetCursorMoveY());

	}

	if( m_pInput->IsKeyUpFirst(VK_LBUTTON) )
	{
		SetActiveBoard(false);
		ReleaseCaptureBoard();

	}		
}
